HAL SPI I/O operation functions ¶
This section provides information about the HAL SPI I/O operation functions migration.
Process Polling ¶
This section provides information about the HAL SPI I/O operations in polling mode.
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Transmit |
HAL_StatusTypeDef HAL_SPI_Transmit(SPI_HandleTypeDef *hspi,
const uint8_t *pData,
uint16_t Size,
uint32_t Timeout);
|
hal_status_t HAL_SPI_Transmit(hal_spi_handle_t *hspi,
const void *p_data,
uint32_t transfer_size,
uint32_t timeout_ms);
|
|
Receive |
HAL_StatusTypeDef HAL_SPI_Receive(SPI_HandleTypeDef *hspi,
uint8_t *pData,
uint16_t Size,
uint32_t Timeout);
|
hal_status_t HAL_SPI_Receive(hal_spi_handle_t *hspi,
void *p_data,
uint32_t transfer_size,
uint32_t timeout_ms);
|
|
Transmit and receive |
HAL_StatusTypeDef HAL_SPI_TransmitReceive(SPI_HandleTypeDef *hspi,
const uint8_t *pTxData,
uint8_t *pRxData,
uint16_t Size,
uint32_t Timeout);
|
hal_status_t HAL_SPI_TransmitReceive(hal_spi_handle_t *hspi,
const void *p_tx_data,
void *p_rx_data,
uint32_t transfer_size,
uint32_t timeout_ms);
|
Process IT ¶
This section provides information about the HAL SPI I/O operations in interrupt mode.
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Transmit IT |
HAL_StatusTypeDef HAL_SPI_Transmit_IT(SPI_HandleTypeDef *hspi,
const uint8_t *pData,
uint16_t Size);
|
hal_status_t HAL_SPI_Transmit_IT(hal_spi_handle_t *hspi,
const void *p_data,
uint32_t transfer_size);
|
|
Receive IT |
HAL_StatusTypeDef HAL_SPI_Receive_IT(SPI_HandleTypeDef *hspi,
uint8_t *pData,
uint16_t Size,
uint32_t Timeout);
|
hal_status_t HAL_SPI_Receive_IT(hal_spi_handle_t *hspi,
void *p_data,
uint32_t transfer_size,
uint32_t timeout_ms);
|
|
Transmit and receive IT |
HAL_StatusTypeDef HAL_SPI_TransmitReceive_IT(SPI_HandleTypeDef *hspi,
const uint8_t *pTxData,
uint8_t *pRxData,
uint16_t Size,
uint32_t Timeout);
|
hal_status_t HAL_SPI_TransmitReceive_IT(hal_spi_handle_t *hspi,
const void *p_tx_data,
void *p_rx_data,
uint32_t transfer_size,
uint32_t timeout_ms);
|
Process DMA ¶
This section provides information about the HAL SPI I/O operations in DMA mode.
|
HAL1 |
HAL2 |
|
|---|---|---|
|
Transmit DMA |
HAL_StatusTypeDef HAL_SPI_Transmit_DMA(SPI_HandleTypeDef *hspi,
const uint8_t *pData,
uint16_t Size);
|
hal_status_t HAL_SPI_Transmit_DMA(hal_spi_handle_t *hspi,
const void *p_data,
uint32_t transfer_size);
|
|
Receive DMA |
HAL_StatusTypeDef HAL_SPI_Receive_DMA(SPI_HandleTypeDef *hspi,
uint8_t *pData,
uint16_t Size);
|
hal_status_t HAL_SPI_Receive_DMA(hal_spi_handle_t *hspi,
void *p_data,
uint32_t transfer_size,
uint32_t timeout_ms);
|
|
Transmit and receive DMA |
HAL_StatusTypeDef HAL_SPI_TransmitReceive_DMA(SPI_HandleTypeDef *hspi,
const uint8_t *pTxData,
uint8_t *pRxData,
uint16_t Size);
|
hal_status_t HAL_SPI_TransmitReceive_DMA(hal_spi_handle_t *hspi,
const void *p_tx_data,
void *p_rx_data,
uint32_t transfer_size);
|
|
Pause DMA |
HAL_StatusTypeDef HAL_SPI_DMAPause(SPI_HandleTypeDef *hspi);
|
The DMA Pause feature is not possible according to the SPI peripheral capability. Given so, the
|
|
Stop DMA |
HAL_StatusTypeDef HAL_SPI_DMAStop(SPI_HandleTypeDef *hspi);
|
Removed from HAL2, use HAL_SPI_Abort(hal_spi_handle_t *hspi) instead.
|
|
Resume DMA |
HAL_StatusTypeDef HAL_SPI_DMAResume(SPI_HandleTypeDef *hspi);
|
The DMA Resume feature is not possible according to the SPI peripheral capability. Given so, the
|
Abort functions ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_SPI_Abort(SPI_HandleTypeDef *hspi);
|
hal_status_t HAL_SPI_Abort(hal_spi_handle_t *hspi);
|
HAL_StatusTypeDef HAL_SPI_Abort_IT(SPI_HandleTypeDef *hspi);
|
hal_status_t HAL_SPI_Abort_IT(hal_spi_handle_t *hspi);
|
HAL SPI IRQHandler function ¶
|
HAL1 |
HAL2 |
|---|---|
void HAL_SPI_IRQHandler(SPI_HandleTypeDef *hspi);
|
void HAL_SPI_IRQHandler(hal_spi_handle_t *hspi);
|
Callback functions ¶
|
Function |
HAL 1 |
HAL 2 |
|---|---|---|
|
Tx Transfer completed callback |
HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi);
|
HAL_SPI_TxCpltCallback(hal_spi_handle_t *hspi);
|
|
Rx Transfer completed callback |
HAL_SPI_RxCpltCallback(SPI_HandleTypeDef *hspi);
|
HAL_SPI_RxCpltCallback(hal_spi_handle_t *hspi);
|
|
TxRx Transfer completed callback |
HAL_SPI_TxRxCpltCallback(SPI_HandleTypeDef *hspi);
|
HAL_SPI_TxRxCpltCallback(hal_spi_handle_t *hspi);
|
|
Tx Half Transfer completed callback |
HAL_SPI_TxHalfCpltCallback(SPI_HandleTypeDef *hspi);
|
HAL_SPI_TxHalfCpltCallback(hal_spi_handle_t *hspi);
|
|
Rx Half Transfer completed callback |
HAL_SPI_RxHalfCpltCallback(SPI_HandleTypeDef *hspi);
|
HAL_SPI_RxHalfCpltCallback(hal_spi_handle_t *hspi);
|
|
Tx and Rx Half Transfer callback |
HAL_SPI_TxRxHalfCpltCallback(SPI_HandleTypeDef *hspi);
|
HAL_SPI_TxRxHalfCpltCallback(hal_spi_handle_t *hspi);
|
|
Error callback |
HAL_SPI_ErrorCallback(SPI_HandleTypeDef *hspi);
|
HAL_SPI_ErrorCallback(hal_spi_handle_t *hspi);
|
|
Abort callback |
HAL_SPI_AbortCpltCallback(SPI_HandleTypeDef *hspi);
|
HAL_SPI_AbortCpltCallback(hal_spi_handle_t *hspi);
|
|
Suspend callback |
HAL_SPI_SuspendCallback(SPI_HandleTypeDef *hspi);
|
HAL_SPI_SuspendCallback(hal_spi_handle_t *hspi);
|
HAL SPIEx enable lock configuration ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_SPIEx_EnableLockConfiguration(SPI_HandleTypeDef *hspi)
|
hal_status_t HAL_SPI_LockIOConfig(const hal_spi_handle_t *hspi)
|
HAL SPIEx configure underrun ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_SPIEx_ConfigureUnderrun(SPI_HandleTypeDef *hspi,
uint32_t UnderrunDetection,
uint32_t UnderrunBehaviour)
|
hal_status_t HAL_SPI_SLAVE_SetConfigUnderrun(const hal_spi_handle_t *hspi,
const hal_spi_underrun_config_t *p_config);
|
HAL SPIEx Flush Rx Fifo ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_SPIEx_FlushRxFifo(const SPI_HandleTypeDef *hspi)
|
In HAL2, The Rx FIFO flush is automatically handled within the process APIs such as
|
Autonomous mode functions ¶
Set configuration ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_SPIEx_SetConfigAutonomousMode(SPI_HandleTypeDef *hspi,
const SPI_AutonomousModeConfTypeDef *sConfig)
|
/* Configure the autonomous mode */
hal_status_t HAL_SPI_AM_SetConfigTrigger(const hal_spi_handle_t *hspi,
const hal_spi_am_trig_config_t *p_config)
/* Enable the autonomous mode*/
hal_status_t HAL_SPI_AM_EnableTrigger(const hal_spi_handle_t *hspi)
|
Get configuration ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_SPIEx_GetConfigAutonomousMode(const SPI_HandleTypeDef *hspi,
SPI_AutonomousModeConfTypeDef *sConfig)
|
void HAL_SPI_AM_GetConfigTrigger(const hal_spi_handle_t *hspi,
hal_spi_am_trig_config_t *p_config)
|
Clear configuration ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_SPIEx_ClearConfigAutonomousMode(SPI_HandleTypeDef *hspi)
|
Function removed in HAL2 (use instead HAL_SPI_AM_DisableTrigger()
and HAL_SPI_AM_SetConfigTrigger() with default settings).
|
HAL SPI enable delay read data sampling ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_SPIEx_EnableDelayReadDataSampling(SPI_HandleTypeDef *hspi)
|
hal_status_t HAL_SPI_EnableDelayReadDataSampling(hal_spi_handle_t *hspi)
|
HAL SPI disable delay read data sampling ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_StatusTypeDef HAL_SPIEx_DisableDelayReadDataSampling(SPI_HandleTypeDef *hspi)
|
hal_status_t HAL_SPI_DisableDelayReadDataSampling(hal_spi_handle_t *hspi)
|